import React, { Component } from 'react'
import { CSSTransition } from 'react-transition-group'

const animate = (WrappedComp) => {
  return class extends Component {
    render() {
      // console.log('111',this.props);
      return (
        <CSSTransition
          in={!!this.props.match}
          timeout={1000}
          className={{
            enter: 'animate__animated',
            enterActive: 'animate__slideInRight',
            exit: 'animate__animated',
            exitActive: 'animate__slideOutLeft'
          }}
          mountOnEnter={true}
          unmountOnExit={true}
        >
          <WrappedComp {...this.props}></WrappedComp>
        </CSSTransition>
      )
    }
  }
}

export default animate